package com.movitech.mobile.cz.base.purchase.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.movitech.mobile.cz.base.common.util.CommonConstants;
import com.movitech.mobile.cz.base.purchase.entity.WFlowFormDiscussionHistory;
import com.movitech.mobile.cz.base.purchase.entity.ext.ExtWFlowFormDiscussionHistory;
import com.movitech.mobile.cz.base.purchase.mapper.WFlowFormDiscussionHistoryMapper;
import com.movitech.mobile.cz.base.purchase.mapper.ext.ExtWFlowFormDiscussionHistoryMapper;
import com.movitech.mobile.cz.base.purchase.service.WFlowFormDiscussionHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 流程表单-一事一议 服务实现类
 * </p>
 *
 * @author Movitech Mobile
 * @since 2018-03-21
 */
@Service
public class WFlowFormDiscussionHistoryServiceImpl extends ServiceImpl<WFlowFormDiscussionHistoryMapper, WFlowFormDiscussionHistory> implements WFlowFormDiscussionHistoryService {

    @Autowired
    private ExtWFlowFormDiscussionHistoryMapper extWFlowFormDiscussionHistoryMapper;
    @Override
    public List<ExtWFlowFormDiscussionHistory> getExtByFormIdAndType(String formId, Integer type) {
        return extWFlowFormDiscussionHistoryMapper.getByFormIdAndType(formId,type);
    }

    @Override
    public Integer selectCountByFormIdAndType(String formId, Integer type) {
        EntityWrapper entityWrapper = new EntityWrapper();
        WFlowFormDiscussionHistory wFlowFormDiscussionHistory = new ExtWFlowFormDiscussionHistory();
        wFlowFormDiscussionHistory.setFlowFormId(formId);
        wFlowFormDiscussionHistory.setDiscussionType(type);
        wFlowFormDiscussionHistory.setDelFlag(CommonConstants.DEL_FLAG_NORMAL);
        entityWrapper.setEntity(wFlowFormDiscussionHistory);
        return selectCount(entityWrapper);
    }
}
